package testdoc

import (
	"jinquan.supor.com/common"
	"go.mongodb.org/mongo-driver/bson/primitive"
)

type Data01Doc struct {
  //DocId: struct里面获取ObjectID, Document必须字段
  DocId     primitive.ObjectID `bson:"_id"`  
  DataId 	int
  Name 		string
  FloatVal 	float32
}


func AllocData01Doc() (Doc []interface{}) {
	Doc = append(Doc, Data01Doc{
		DocId: primitive.NewObjectID(), 
		DataId: 0, 
		Name: "", 
		FloatVal: 0.0,
	})
	return
}


func GenData01DocArray(N int) (Doc []interface{}) {
	var i int
		for i = 0; i < N; i++ {
			Doc = append(Doc, Data01Doc{
				DocId:     primitive.NewObjectID(),
				DataId:    common.Irand(1000),
				Name:  common.Srand(16, common.KC_RAND_KIND_ALL),
				FloatVal: common.Frand(1.5, 6.3),
			})
		}
	return
}
